/*
 * $Id: codetemplates.xml ver yyyy-mm-dd rb $
 */
package com.qy.wap.bean;

import java.util.List;
/**
 *
 *
 * @author ts-biao.zhang
 */
public class Table {
    private String name;
    private List<Column> columns;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public List<Column> getColumns() {
        return columns;
    }
    public void setColumns(List<Column> columns) {
        this.columns = columns;
    }
    public String getCreateString()
    {
        StringBuilder sb = new StringBuilder();
        sb.append("CREATE TABLE ");
        sb.append(this.name);
        sb.append("(");
        for(int i=0;i<columns.size();i++)
        {
            sb.append(columns.get(i).getCreateString());
            if(i != columns.size() -1)
            {
                sb.append(",");
            }
        }
        sb.append(")");
        return sb.toString().replaceAll("\\$", "");
    }
}
